package com.eliza.databind.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.databinding.DataBindingUtil
import com.eliza.databind.R
import com.eliza.databind.databinding.ActivityDatabindBaseBinding
import com.eliza.databind.listen.EventListener
import com.eliza.databind.model.User

class DbActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_databind_base)
        /**
         * 与 databind 页面相绑定 */
        val dbv = DataBindingUtil.setContentView<ActivityDatabindBaseBinding>(
            this,
            R.layout.activity_databind_base
        )

        dbv.user = User("OK", 2)

        dbv.onClickListener = EventListener(this)

    }
}